﻿using System.Collections.Generic;
using Microsoft.Xna.Framework;

namespace BlawkayEngine.ScreenSystem
{
    public abstract class MenuScreen : Screen
    {
        public MenuScreen(Game oGame, string oTitle)
            : base(oGame)
        {
            Title = oTitle;
            Options = new List<string>();
            Index = 0;
        }

        protected abstract void Select(ScreenManager oManager);

        protected abstract void Cancel(ScreenManager oManager);

        protected void IndexUp()
        {
            if (Options.Count == 0)
                return;

            _Index++;
            if (Index >= _Options.Count)
                Index = 0;
        }

        protected void IndexDown()
        {
            if (Options.Count == 0)
                return;

            Index--;
            if (Index < 0)
                Index = Options.Count - 1;
        }

        protected void AddMenuOption(string oOption)
        {
            oOption = oOption.Replace('_', ' ');
            Options.Add(oOption);
        }

        #region Properties

        public string Title
        {
            get { return _Title; }
            set { _Title = value; }
        }
        public List<string> Options
        {
            get { return _Options; }
            set { _Options = value; }
        }
        public int Index
        {
            get { return _Index; }
            set { _Index = value; }
        }

        #endregion

        #region Fields

        private string _Title;
        private List<string> _Options;
        private int _Index;

        #endregion

    }
}
